# closure_counter.py

def counter():
    count = 0

    def increment():
        nonlocal count
        count += 1
        return count

    return increment

# 测试
cnt = counter()
print(cnt())  # 输出：1
print(cnt())  # 输出：2